home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / xpcom / nsIThread.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  9KB  |  257 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsIThread.idl
  3.  */
  4.  
  5. #ifndef __gen_nsIThread_h__
  6. #define __gen_nsIThread_h__
  7.  
  8.  
  9. #ifndef __gen_nsISupports_h__
  10. #include "nsISupports.h"
  11. #endif
  12.  
  13. /* For IDL files that don't want to include root IDL files. */
  14. #ifndef NS_NO_VTABLE
  15. #define NS_NO_VTABLE
  16. #endif
  17. #include "prthread.h"
  18. #define NS_THREAD_CID                                \
  19. { /* 85CE5510-7808-11d3-A181-0050041CAF44 */         \
  20.     0x85ce5510,                                      \
  21.     0x7808,                                          \
  22.     0x11d3,                                          \
  23.     {0xa1, 0x81, 0x00, 0x50, 0x04, 0x1c, 0xaf, 0x44} \
  24. }
  25. #define NS_THREAD_CONTRACTID "@mozilla.org/thread;1"
  26. #define NS_THREAD_CLASSNAME "Thread"
  27. #if 0
  28. typedef PRUint32 PRThreadPriority;
  29.  
  30. typedef PRUint32 PRThreadScope;
  31.  
  32. typedef PRUint32 PRThreadState;
  33.  
  34. #endif
  35. class nsIRunnable; /* forward declaration */
  36.  
  37.  
  38. /* starting interface:    nsIThread */
  39. #define NS_ITHREAD_IID_STR "6be5e380-6886-11d3-9382-00104ba0fd40"
  40.  
  41. #define NS_ITHREAD_IID \
  42.   {0x6be5e380, 0x6886, 0x11d3, \
  43.     { 0x93, 0x82, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40 }}
  44.  
  45. class nsIThread : public nsISupports {
  46.  public: 
  47.  
  48.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_ITHREAD_IID)
  49.  
  50.   enum { PRIORITY_LOW = 0U };
  51.  
  52.   enum { PRIORITY_NORMAL = 1U };
  53.  
  54.   enum { PRIORITY_HIGH = 2U };
  55.  
  56.   enum { PRIORITY_URGENT = 3U };
  57.  
  58.   enum { SCOPE_LOCAL = 0U };
  59.  
  60.   enum { SCOPE_GLOBAL = 1U };
  61.  
  62.   enum { SCOPE_BOUND = 2U };
  63.  
  64.   enum { STATE_JOINABLE = 0U };
  65.  
  66.   enum { STATE_UNJOINABLE = 1U };
  67.  
  68.   /* void join (); */
  69.   NS_IMETHOD Join(void) = 0;
  70.  
  71.   /* void interrupt (); */
  72.   NS_IMETHOD Interrupt(void) = 0;
  73.  
  74.   /* attribute PRThreadPriority priority; */
  75.   NS_IMETHOD GetPriority(PRThreadPriority *aPriority) = 0;
  76.   NS_IMETHOD SetPriority(PRThreadPriority aPriority) = 0;
  77.  
  78.   /* readonly attribute PRThreadScope scope; */
  79.   NS_IMETHOD GetScope(PRThreadScope *aScope) = 0;
  80.  
  81.   /* readonly attribute PRThreadState state; */
  82.   NS_IMETHOD GetState(PRThreadState *aState) = 0;
  83.  
  84.   /* [noscript] PRThread GetPRThread (); */
  85.   NS_IMETHOD GetPRThread(PRThread * *_retval) = 0;
  86.  
  87.   /* void init (in nsIRunnable aRunnable, in PRUint32 aStackSize, in PRThreadPriority aPriority, in PRThreadScope aScope, in PRThreadState aState); */
  88.   NS_IMETHOD Init(nsIRunnable *aRunnable, PRUint32 aStackSize, PRThreadPriority aPriority, PRThreadScope aScope, PRThreadState aState) = 0;
  89.  
  90.   /* readonly attribute nsIThread currentThread; */
  91.   NS_IMETHOD GetCurrentThread(nsIThread * *aCurrentThread) = 0;
  92.  
  93.   /* void sleep (in PRUint32 msec); */
  94.   NS_IMETHOD Sleep(PRUint32 msec) = 0;
  95.  
  96.     // returns the nsIThread for the current thread:
  97.     static NS_COM nsresult GetCurrent(nsIThread* *result);
  98.     // returns the nsIThread for an arbitrary PRThread:
  99.     static NS_COM nsresult GetIThread(PRThread* prthread, nsIThread* *result);
  100.     // initializes the "main" thread (really, just saves the current thread
  101.     // at time of calling. meant to be called once at app startup, in lieu
  102.     // of proper static initializers, to save the primordial thread
  103.     // for later recall.)
  104.     static NS_COM nsresult SetMainThread();
  105.     // return the "main" thread
  106.     static NS_COM nsresult GetMainThread(nsIThread **result);
  107.     static NS_COM PRBool IsMainThread(); 
  108. };
  109.  
  110. /* Use this macro when declaring classes that implement this interface. */
  111. #define NS_DECL_NSITHREAD \
  112.   NS_IMETHOD Join(void); \
  113.   NS_IMETHOD Interrupt(void); \
  114.   NS_IMETHOD GetPriority(PRThreadPriority *aPriority); \
  115.   NS_IMETHOD SetPriority(PRThreadPriority aPriority); \
  116.   NS_IMETHOD GetScope(PRThreadScope *aScope); \
  117.   NS_IMETHOD GetState(PRThreadState *aState); \
  118.   NS_IMETHOD GetPRThread(PRThread * *_retval); \
  119.   NS_IMETHOD Init(nsIRunnable *aRunnable, PRUint32 aStackSize, PRThreadPriority aPriority, PRThreadScope aScope, PRThreadState aState); \
  120.   NS_IMETHOD GetCurrentThread(nsIThread * *aCurrentThread); \
  121.   NS_IMETHOD Sleep(PRUint32 msec); \
  122.  
  123. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  124. #define NS_FORWARD_NSITHREAD(_to) \
  125.   NS_IMETHOD Join(void) { return _to Join(); } \
  126.   NS_IMETHOD Interrupt(void) { return _to Interrupt(); } \
  127.   NS_IMETHOD GetPriority(PRThreadPriority *aPriority) { return _to GetPriority(aPriority); } \
  128.   NS_IMETHOD SetPriority(PRThreadPriority aPriority) { return _to SetPriority(aPriority); } \
  129.   NS_IMETHOD GetScope(PRThreadScope *aScope) { return _to GetScope(aScope); } \
  130.   NS_IMETHOD GetState(PRThreadState *aState) { return _to GetState(aState); } \
  131.   NS_IMETHOD GetPRThread(PRThread * *_retval) { return _to GetPRThread(_retval); } \
  132.   NS_IMETHOD Init(nsIRunnable *aRunnable, PRUint32 aStackSize, PRThreadPriority aPriority, PRThreadScope aScope, PRThreadState aState) { return _to Init(aRunnable, aStackSize, aPriority, aScope, aState); } \
  133.   NS_IMETHOD GetCurrentThread(nsIThread * *aCurrentThread) { return _to GetCurrentThread(aCurrentThread); } \
  134.   NS_IMETHOD Sleep(PRUint32 msec) { return _to Sleep(msec); } \
  135.  
  136. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  137. #define NS_FORWARD_SAFE_NSITHREAD(_to) \
  138.   NS_IMETHOD Join(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->Join(); } \
  139.   NS_IMETHOD Interrupt(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->Interrupt(); } \
  140.   NS_IMETHOD GetPriority(PRThreadPriority *aPriority) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetPriority(aPriority); } \
  141.   NS_IMETHOD SetPriority(PRThreadPriority aPriority) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetPriority(aPriority); } \
  142.   NS_IMETHOD GetScope(PRThreadScope *aScope) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetScope(aScope); } \
  143.   NS_IMETHOD GetState(PRThreadState *aState) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetState(aState); } \
  144.   NS_IMETHOD GetPRThread(PRThread * *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetPRThread(_retval); } \
  145.   NS_IMETHOD Init(nsIRunnable *aRunnable, PRUint32 aStackSize, PRThreadPriority aPriority, PRThreadScope aScope, PRThreadState aState) { return !_to ? NS_ERROR_NULL_POINTER : _to->Init(aRunnable, aStackSize, aPriority, aScope, aState); } \
  146.   NS_IMETHOD GetCurrentThread(nsIThread * *aCurrentThread) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCurrentThread(aCurrentThread); } \
  147.   NS_IMETHOD Sleep(PRUint32 msec) { return !_to ? NS_ERROR_NULL_POINTER : _to->Sleep(msec); } \
  148.  
  149. #if 0
  150. /* Use the code below as a template for the implementation class for this interface. */
  151.  
  152. /* Header file */
  153. class nsThread : public nsIThread
  154. {
  155. public:
  156.   NS_DECL_ISUPPORTS
  157.   NS_DECL_NSITHREAD
  158.  
  159.   nsThread();
  160.  
  161. private:
  162.   ~nsThread();
  163.  
  164. protected:
  165.   /* additional members */
  166. };
  167.  
  168. /* Implementation file */
  169. NS_IMPL_ISUPPORTS1(nsThread, nsIThread)
  170.  
  171. nsThread::nsThread()
  172. {
  173.   /* member initializers and constructor code */
  174. }
  175.  
  176. nsThread::~nsThread()
  177. {
  178.   /* destructor code */
  179. }
  180.  
  181. /* void join (); */
  182. NS_IMETHODIMP nsThread::Join()
  183. {
  184.     return NS_ERROR_NOT_IMPLEMENTED;
  185. }
  186.  
  187. /* void interrupt (); */
  188. NS_IMETHODIMP nsThread::Interrupt()
  189. {
  190.     return NS_ERROR_NOT_IMPLEMENTED;
  191. }
  192.  
  193. /* attribute PRThreadPriority priority; */
  194. NS_IMETHODIMP nsThread::GetPriority(PRThreadPriority *aPriority)
  195. {
  196.     return NS_ERROR_NOT_IMPLEMENTED;
  197. }
  198. NS_IMETHODIMP nsThread::SetPriority(PRThreadPriority aPriority)
  199. {
  200.     return NS_ERROR_NOT_IMPLEMENTED;
  201. }
  202.  
  203. /* readonly attribute PRThreadScope scope; */
  204. NS_IMETHODIMP nsThread::GetScope(PRThreadScope *aScope)
  205. {
  206.     return NS_ERROR_NOT_IMPLEMENTED;
  207. }
  208.  
  209. /* readonly attribute PRThreadState state; */
  210. NS_IMETHODIMP nsThread::GetState(PRThreadState *aState)
  211. {
  212.     return NS_ERROR_NOT_IMPLEMENTED;
  213. }
  214.  
  215. /* [noscript] PRThread GetPRThread (); */
  216. NS_IMETHODIMP nsThread::GetPRThread(PRThread * *_retval)
  217. {
  218.     return NS_ERROR_NOT_IMPLEMENTED;
  219. }
  220.  
  221. /* void init (in nsIRunnable aRunnable, in PRUint32 aStackSize, in PRThreadPriority aPriority, in PRThreadScope aScope, in PRThreadState aState); */
  222. NS_IMETHODIMP nsThread::Init(nsIRunnable *aRunnable, PRUint32 aStackSize, PRThreadPriority aPriority, PRThreadScope aScope, PRThreadState aState)
  223. {
  224.     return NS_ERROR_NOT_IMPLEMENTED;
  225. }
  226.  
  227. /* readonly attribute nsIThread currentThread; */
  228. NS_IMETHODIMP nsThread::GetCurrentThread(nsIThread * *aCurrentThread)
  229. {
  230.     return NS_ERROR_NOT_IMPLEMENTED;
  231. }
  232.  
  233. /* void sleep (in PRUint32 msec); */
  234. NS_IMETHODIMP nsThread::Sleep(PRUint32 msec)
  235. {
  236.     return NS_ERROR_NOT_IMPLEMENTED;
  237. }
  238.  
  239. /* End of implementation class template. */
  240. #endif
  241.  
  242. extern NS_COM nsresult
  243. NS_NewThread(nsIThread* *result, 
  244.              nsIRunnable* runnable,
  245.              PRUint32 stackSize = 0,
  246.              PRThreadState state = PR_UNJOINABLE_THREAD,
  247.              PRThreadPriority priority = PR_PRIORITY_NORMAL,
  248.              PRThreadScope scope = PR_GLOBAL_THREAD);
  249. extern NS_COM nsresult
  250. NS_NewThread(nsIThread* *result, 
  251.              PRUint32 stackSize = 0,
  252.              PRThreadState state = PR_UNJOINABLE_THREAD,
  253.              PRThreadPriority priority = PR_PRIORITY_NORMAL,
  254.              PRThreadScope scope = PR_GLOBAL_THREAD);
  255.  
  256. #endif /* __gen_nsIThread_h__ */
  257.